public class Likou_soushuocharuweizhi {
    class Solution {
        public int searchInsert(int[] nums, int target) {
            for(int i = 0; i<nums.length; i++){
                if(nums[i]==target){
                    return i;
                }
            }
            int j = 0;
            for(j = 0; j<nums.length-1;j++){
                if(target > nums[j] && target<nums[j+1]){
                    return j+1;
                }
            }
            if(target<nums[j]){
                return 0;
            }
            return j+1;
        }
    }
}
